<?php
//$cs = Yii::app()->getClientScript();   
//$cs->registerCSSFile(Yii::app()->request->baseUrl . '/css/bootstrap-datetimepicker.min.css');
//$cs->registerScriptFile(Yii::app()->request->baseUrl . '/js/bootstrap-datetimepicker.min.js'); 
$todayBegin = strtotime(date('Y-m-d',time()).' 00:00:00');
$todayEnd = $todayBegin + 60 * 60 * 24;?>
<meta name="viewport" contdent="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="full-screen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl.'/css/bootstrap-datetimepicker.min.css';?>"/>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl.'/js/bootstrap-datetimepicker.min.js';?>"></script>
<script type="text/javascript">
function choosedTime() {
    var timeStr = $("input[name=time]").val();
    var timeArr = timeStr.split("/");
    var timestamp = (new Date(timeArr[2]+"-"+timeArr[0]+"-"+timeArr[1]+" 00:00:00").getTime())/1000;//毫秒转化为秒
    var url = "<?php echo $control->getAjaxLinkUrl($backPage);?>";
    
    if("<?php echo $backPage;?>" == "manageBooking_bookingList") {
        var findText = "/findText/paymentStatus=<?php echo bcart::Payment_Status_Paid;?>+groupBy=paidTime+paidTime>="+timestamp;
        var flagText = "/flagText/"+timeArr[2]+"-"+timeArr[0]+"-"+timeArr[1]+"预订";
        url = url.replace("/dv/wx/",findText+flagText+"/dv/wx/"); 
        backToPage(url);
    } 
    else if("<?php echo $backPage;?>" =="manageBooking_remainList"){
        var endTimeStamp = timestamp + 60 * 60 * 24;
        var findText = "/findText/city=china.chongqing+bookingStatus=available+startTime>="+timestamp+"+endTime<="+endTimeStamp;
        var flagText = "/flagText/"+timeArr[2]+"-"+timeArr[0]+"-"+timeArr[1]+"剩余场地";
        url = url.replace("/dv/wx/",findText+flagText+"/dv/wx/"); 
        backToPage(url);
    }
}
function backToPage(url) {
    jQuery.ajax({
	type:'POST',
	url:url,
	beforeSend:function(){$("#ajax-loaderdiv").show();},
	complete:function(){$("#ajax-loaderdiv").hide();},
	cache:false,
        data:'',
	success:function(html){jQuery("#show_page_content").html(html)}
    }); 
}
</script>
<style type="text/css">
ul {padding: 0px;}
.bootstrap-datetimepicker-widget {display:block;margin-top:53px;width: 100%}
.bootstrap-datetimepicker-widget:before {display:none !important;}
.bootstrap-datetimepicker-widget:after {display:none !important;}
.dropdown-menu {box-shadow: 0 0 0 white inset !important;border:0 !important;}
.btn-cancel {
    width: 99%;
    height: 35px;
    background-color: white;
    border: 1px solid #2bb2a3;
    color: #2bb2a3;
}
</style>
<body>
    <header class="navbar" style="min-height:52px;">
        <table style="width:100%;">
            <tr>
                <td style="width:10%;text-align:left;">
                    <div style="margin-top:8px;margin-left:10px;"><?php
                        echo $control->getAjaxLink(array(
                            'name' => '<img src="'.Yii::app()->request->baseUrl.'/images/mobile/backbtn.png'.'" />', 
                            'id' => $backPage), array(
                            'findText'=>$findText,
                            'flagText'=>$flagText,
                            'htmlOptions' => array(
                            'enctype' => 'multipart/form-data'
                        )));?>
                    </div>
                </td>
                <td style="width:80%;text-align:center;"><h4 style="margin-top:15px;">选择日期</h4></td>
                <td style="width:10%;text-align:right;"></td>
            </tr>
        </table>
        <div id="ajax-loaderdiv" style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 35000;background-color: rgba(0, 0, 0, 0.3);display: none;">
            <img src="/billyn-dev/images/ajax-loader.gif" class="ajax-loader"style="position: absolute;left: 50%;top: 50%;margin-left: -16px;margin-top: -16px;display: block;"/>
        </div>
    </header>
    <dl>
        <dd>
            <input size="16" type="text" name="time" readonly class="form_datetime" style="display:none;">
            <script type="text/javascript">
                $(".bootstrap-datetimepicker-widget").remove();
                $(".form_datetime").datetimepicker({
                    language: 'pt-BR'
                });
            </script>
            <table style="width:100%;margin-top:260px;">
                <tr>
                    <td>
                        <a href="#" class="btn btn-cancel" onclick="choosedTime()">确定</a>
                    </td>
                    <td><?php
                        echo $control->getAjaxLink(array('name' => '取消', 'id' => $backPage), array(
                            'findText'=>$findText,
                            'flagText'=>$flagText,
                            'htmlOptions' => array(
                            'enctype' => 'multipart/form-data',
                            'class'=>'btn btn-cancel'
                        )));?></td>
                </tr>
            </table>
        </dd>
    </dl>
    <footer>
        <div class="footer-copyright">
            <div class="hr"></div>
            <span class="footer-copyright-text">
                Copyright © 2014 billyn.net </span>
        </div>
    </footer>
</body>